<template>
    <div>
        <button v-for="(item, index) in btn_arr" :key="index" @click="fn(index)">{{ item }}</button>
        <components :is="page[a]"></components>
    </div>
</template>
<script>
import TapSonOne from "@/components/TapSonOne.vue"
import TapSonTwo from "@/components/TapSonTwo.vue"
export default {
    components: {
        TapSonOne,
        TapSonTwo
    },
    data() {
        return {
            a: 0,
            page: [TapSonOne, TapSonTwo],
            btn_arr: ["页面一", "页面二"]
        }
    },
    methods: {
        fn(index) {
            this.a = index
        }
    },
}
</script>
